
########################################
############# Figure 6a ################
########################################

library(sf)
library(ggplot2)
library(dplyr)
library(rnaturalearth)

world <- rnaturalearth::ne_countries(scale = "medium", returnclass = "sf")
world <- world %>% filter(name != "Antarctica")

# List of countries to highlight (harmonized to account for different naming conventions)
highlight_countries <- c(
  "Albania", "Algeria", "Argentina", "Armenia", "Australia", "Austria", 
  "Azerbaijan", "Barbados", "Belarus", "Belgium", "Bhutan", "Bolivia", 
  "Bosnia and Herz.", "Brazil", "Bulgaria", "Canada", "Cabo Verde", 
  "Chile", "Colombia", "Costa Rica", "Croatia", "Cuba", "Cyprus", "Czechia", 
  "Denmark", "Dominican Rep.", "Ecuador", "Egypt", "El Salvador", 
  "Estonia", "Finland", "France", "Georgia", "Germany", "Greece", 
  "Guatemala", "Hong Kong", "Hungary", "Iceland", "Iran", "Ireland", 
  "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kosovo", 
  "Kuwait", "Kyrgyzstan", "Latvia", "Lebanon", "Lithuania", "Luxembourg", 
  "Malaysia", "Maldives", "Malta", "Mauritius", "Mexico", "Moldova", 
  "Mongolia", "Montenegro", "Namibia", "Netherlands", "New Zealand", 
  "Nicaragua", "North Macedonia", "Norway", "Oman", "Palestine", "Panama", 
  "Paraguay", "Peru", "Philippines", "Poland", "Portugal", "Qatar", 
  "Romania", "Russia", "Serbia", "Seychelles", "Singapore", "Slovakia", 
  "Slovenia", "South Africa", "South Korea", "Spain", "Suriname", 
  "Sweden", "Switzerland", "Taiwan", "Tajikistan", "Thailand", "Tunisia", 
  "Turkey", "Ukraine", "United Arab Emirates", "United Kingdom", 
  "United States of America", "Uruguay", "Uzbekistan"
)

world <- world %>%
  mutate(highlight = ifelse(name %in% highlight_countries, "Highlight", "Outline"))

# Create the map
ggplot(world) +
  geom_sf(aes(fill = highlight), color = "black", size = 0.1) +
  scale_fill_manual(values = c("Highlight" = "lightblue", "Outline" = "white"), guide = "none") +
  coord_sf(crs = "+proj=robin") +  
  theme_minimal() +
  theme(
    panel.grid.major = element_blank(),  
    panel.grid.minor = element_blank(),  
    axis.text = element_blank(),        
    axis.ticks = element_blank()         
  )


ggsave(
  filename = "Figures/fig6a.eps", 
  plot = last_plot(), device = "eps", width = 10, height = 5, units = "in",   
)

